1779G - The Game of the Century - CodeForces Solution


constructive algorithms graphs shortest paths *3000

Please click on ads to support us..

C++ Code:

#include<cstdio>
using namespace std;
const int o=1e5+10;
int T,n,ans;char s[3][o];
int main(){
	for(scanf("%d",&T);T--;printf("%d\n",ans),ans=0){
		scanf("%d%s%s%s",&n,s[0]+1,s[1]+1,s[2]+1);
		for(int i=0;i<3;++i) for(int j=i+1;j<3;++j)
			if(s[i][n]^s[j][n]) for(int k=n;s[i][k]==s[i][n]&&s[j][k]==s[j][n];--k) ++ans;
		if(ans>n) ans=n;
	}
	return 0;
}


Comments

Submit
0 Comments
More Questions

1445B - Elimination
1656C - Make Equal With Mod
567A - Lineland Mail
1553A - Digits Sum
1359B - New Theatre Square
766A - Mahmoud and Longest Uncommon Subsequence
701B - Cells Not Under Attack
702A - Maximum Increase
1656D - K-good
1426A - Floor Number
876A - Trip For Meal
1326B - Maximums
1635C - Differential Sorting
961A - Tetris
1635B - Avoid Local Maximums
20A - BerOS file system
1637A - Sorting Parts
509A - Maximum in Table
1647C - Madoka and Childish Pranks
689B - Mike and Shortcuts
379B - New Year Present
1498A - GCD Sum
1277C - As Simple as One and Two
1301A - Three Strings
460A - Vasya and Socks
1624C - Division by Two and Permutation
1288A - Deadline
1617A - Forbidden Subsequence
914A - Perfect Squares
873D - Merge Sort